// =======================================================================
// 
//       Filename:  process.hpp
// 
//    Description:  
// 
//        Version:  1.0
//        Created:  03.05.2010 17:59:52
//       Revision:  none
//       Compiler:  g++
// 
//         Author:  Dominik 'domachine' Burgdörfer (-), dominik.burgdoerfer@googlemail.com
//        Company:  -
// 
// =======================================================================


#ifndef  PROCESS_INC
#define  PROCESS_INC
#include "popen2.hpp"
#include <iostream>
#include <cstring>

namespace webplodder {
    namespace process {
        class Process {
        public:
            Process(const std::string& command);

            pid_t launch();

            bool operator>>(char& ch);

            Process& operator<<(char ch);

            void closeReadChannel();

            void closeWriteChannel();

            void close();

        private:
            std::string m_command;
            int m_fileDescriptors[2];
        };
    }
}
#endif   // ----- #ifndef PROCESS_INC  -----
